package system.security.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import system.security.dao.ResourceTypeDao;
import system.security.entity.ResourceType;
import system.security.service.ResourceTypeService;


@Transactional
@Service("resourceTypeService")
public class ResourceTypeServiceImpl implements ResourceTypeService {

	@Autowired
	private ResourceTypeDao resourceTypeDao;
	
	@Override
	public ResourceType getById(int resourceTypeId) {
		ResourceType resourceType = resourceTypeDao.get(resourceTypeId);
		return resourceType;
	}


	@Override
	@Transactional(readOnly = true)
	public List<ResourceType> getAll() {
		return resourceTypeDao.list();
	}
	
	
	@Override
	public void save(ResourceType resourceType) throws Exception {
			resourceTypeDao.saveOrUpdate(resourceType);
	}

	@Override
	public void delete(int resourceTypeId) {
		resourceTypeDao.remove(resourceTypeId);
	}
	
	@Override
	public void delete(ResourceType resourceType){
		resourceTypeDao.remove(resourceType);		
	}


	@Override
	public ResourceType findByName(String name) {
		// TODO Auto-generated method stub
		return null;
	}
	
}
